//主从表tab选项卡标志位
var A19074_Tab_Flag = -1;
//选择某一行
var A19074_select_role_control_rowId = "";
//按钮事件新增或编辑
var A19074_type = "";
//其他页面传到本页面参数
var A19074_param = {};
//本页面传到其他页面参数
var A19074_toparam = {};
//table选中数据，如无则默认第一条
var A19074_rowCheckData = null;
//当前触发按钮
var A19074_btn = "";
//上一次触发的按钮
var A19074_prev_btn = "";
//树形节点选择
var A19074_select_TreeNode = {};
//表格数据服务端分页或客户端分页 1:服务端 0:客户端
var A19074_table_page = 0;

/*定义查询条件变量*/
/*declare query param begin*/
var A19074_tem_ROLE_NAME = "";

/*declare query param end*/

/*定义下拉框集合定义*/
/*declare select options begin*/
var A19074_ary_S_STATE = [{"MAIN_ID":"1","CN_NAME":"启用"},{"MAIN_ID":"0","CN_NAME":"禁用"}];

/*declare select options end*/

/*文件附件格式*/
/*input param fileinfo begin*/

/*input param fileinfo end*/

/*绑定show监听事件*/
if(A19074_Tab_Flag == -1){
	var A19074_n = Get_RandomDiv("A19074","");
	$(A19074_n).bind("show", function(objTag){
		A19074_Adjust_Sub_Sequ();	
	});
}

//设置主从表div顺序
function A19074_Adjust_Sub_Sequ(){
	var temSubDivs = $("#content-main").find("div[data-id]");
	var MainDiv = $(Get_RandomDiv("A19074",""));
	for(i = 0; i < temSubDivs.length; i++) {
		if(A19074_Is_Sub_Div(temSubDivs[i].id)){
			$(temSubDivs[i]).before($(MainDiv));
			break;
		}
	}
}

//判断是否sub子项div页面
function A19074_Is_Sub_Div(temDivId){
    if(temDivId.indexOf("XX$TTT") == 0)
        return false;
    return false;
}

//主从表传递参数
function A19074_param_set(){
	/*Main Subsuv Table Param Begin*/
    if(A19074_param.hasOwnProperty("ROLE_NAME"))
        $("#A19074_qry_ROLE_NAME").val(A19074_param["ROLE_NAME"]);
    if(A19074_param.hasOwnProperty("hidden_find")){
        $("#A19074_qry_ROLE_NAME").attr("disabled", true);
    }	
	/*Main Subsuv Table Param end*/
}

//业务逻辑数据开始
function A19074_role_control_biz_start(inputparam) {
	layer.close(ly_index);
	A19074_param = inputparam;
	//主从表传递参数
	A19074_param_set();	
    /*biz begin*/
	A19074_init_role_control();
	
    /*biz end*/
}

/*业务函数步骤*/
/*biz step begin*/
/*biz step end*/

/*查找框函数*/
/*find qry fun begin*/

/*find qry fun end*/

/*页面结束*/
function A19074_page_end(){
	A19074_sub_show();
}

//按钮弹窗

//按钮定义
function A19074_Upd_EvaFormatter(value, row, index) {
}

//用户显示列定义
var A19074_role_control = [
	/*table column begin*/
    {
        title: '主键',
        field: 'MAIN_ID',
        sortable: true,
        visible: false,
        width: 40
    },
    {
        title: '角色名称',
        field: 'ROLE_NAME',
        sortable: true,
        width: 60
        ,formatter: set_s_decode
    }
];

//页面初始化
function A19074_init_role_control() {
	$(window).resize(function () {
		  $('#A19074_role_control_Events').bootstrapTable('resetView');
	});
	//用户查询条件初始化设置
	/*query conditions init begin*/
	
    /*query conditions init end*/
	
	$('#A19074_btn_role_control_query').click();
}

//查询接口
function A19074_role_control_query() {
    $('#A19074_role_control_Events').bootstrapTable("removeAll");
	//以下为特殊字段列表查询，无特殊字段时不需要
	var inputdata = {
		"param_name": "N01_sel_t_role",
		"session_id": session_id,
		"login_id": login_id
		/*传递查询条件变量*/
        /*get query param begin*/
        ,"param_value1": s_encode(A19074_tem_ROLE_NAME)
		
        /*get query param end*/
	};
	ly_index = layer.load();
	if(A19074_table_page == 1){
		inputdata = {"N01_sel_t_role":[]};
		A19074_get_N01_sel_t_role(inputdata);
	}
	else{
		delete inputdata["pageNumber"];
		delete inputdata["pageSize"];
		get_ajax_baseurl(inputdata, "A19074_get_N01_sel_t_role");
	}
}

//树形结构函数定义
/*tree function defined begin*/
/*tree function defined end*/

//查询结果
function A19074_get_N01_sel_t_role(input) {
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.N01_sel_t_role) == false)
        return false;
    //树形结构函数调用
    /*tree function run begin*/

    /*tree function run end*/    
    A19074_rowCheckData = null;
    //调整table各列宽度
        
	var s_data = input.N01_sel_t_role;
	A19074_select_role_control_rowId = "";
    if(s_data.length > 0){
    	A19074_rowCheckData = s_data[0]; 
    }
    //table对应的属性
    var temTableAtt = {};
    if(A19074_table_page == 1){
    	temTableAtt["url"] = bizzUrl;
    	temTableAtt["method"] = "get";
    	temTableAtt["sidePagination"] = "server";
    	temTableAtt["queryParamsType"] = "limit";
    }
    else{
    	temTableAtt["url"] = null;
    	temTableAtt["method"] = null;
    	temTableAtt["sidePagination"] = null;
    	temTableAtt["queryParamsType"] = null;
    }    
    $('#A19074_role_control_Events').bootstrapTable('destroy');
    $("#A19074_role_control_Events").bootstrapTable({
        uniqueId: 'main_id',
        search: 0,
        pagination: !0,
        showRefresh: 0,
        showToggle: 0,
        locale: "zh-CN",
        showColumns: 0,
        showExport: 0,
        exportDataType:"all",
        exportTypes:['excel'],
        iconSize: "outline",
        onClickRow: function (row, $element) {
            // 判断是否已选中
            if (A19074_prev_btn == A19074_btn && $($element).hasClass("changeColor")) {
                $('#A19074_role_control_Events').find("tr.changeColor").removeClass('changeColor');
                A19074_select_role_control_rowId = "";
            }
            else {
                // 未点击则，为当前行添加 class='changeColor'
                $('#A19074_role_control_Events').find("tr.changeColor").removeClass('changeColor');
                $($element).addClass('changeColor');                　
                A19074_select_role_control_rowId = $element.attr('data-index');
                
                //设置子表查询条件
                /*set child table qry begin*/
                
                /*set child table qry end*/
                A19074_sub_show();
            }
        },
		onDblClickRow: function (row){
			if(A19074_param.hasOwnProperty("target_name"))
			{
				$("#"+A19074_param["target_id"]).val(eval("row."+A19074_param["sourc_id"].toUpperCase()));
				$("#"+A19074_param["target_name"]).val(s_decode(eval("row."+A19074_param["sourc_name"].toUpperCase())));				
				layer.close(A19074_param["ly_index"]);
			}
		},
        toolbar: "#A19074_role_control_Toolbar",
        url: temTableAtt["url"],
        method: temTableAtt["method"],
        height:500,
        columns: A19074_role_control,
        data: s_data,
        pageNumber: 1,
        pageSize: 10, // 每页的记录行数（*）
        pageList: [10,50,100,1000,2000], // 可供选择的每页的行数（*）
        queryParams: A19074_role_control_queryParams,
        sidePagination: temTableAtt["sidePagination"],//"server", //服务端处理分页
	    queryParamsType : temTableAtt["queryParamsType"],//"limit",//设置为 ‘limit’ 则会发送符合 RESTFul 格式的参数.
        icons: {
            refresh: "glyphicon-repeat",
            toggle: "glyphicon-list-alt",
            columns: "glyphicon-list"
        },
        onPostBody:function(){
        },
        onLoadSuccess: function(input){
        	if(input.rows.length > 0)
        		A19074_rowCheckData = input.rows[0]; 
        },
        onLoadError: function(err){
            console.log("error: "+err);
        },
        responseHandler:A19074_Res_N01_sel_role_control
    });
	A19074_page_end();
}

//设置参数
function A19074_role_control_queryParams(inputdata){
	ly_index = layer.load();
	if(A19074_table_page == 0)
		return null;
	var temdata = {
		"param_name": "N01_sel_t_role",
		"session_id": session_id,
		"login_id": login_id
		/*传递查询条件变量*/
        /*get query param begin*/
        ,"param_value1": s_encode(A19074_tem_ROLE_NAME)
        /*get query param end*/
	};	
	for (var key in temdata) {
		inputdata[key] = temdata[key];
    }
	if(inputdata.hasOwnProperty("offset") && inputdata.hasOwnProperty("limit")){
		inputdata["pageNumber"] = parseInt(inputdata["offset"] / inputdata["limit"]) + 1;
		inputdata["pageSize"] = inputdata["limit"];
	}
	else{
		inputdata["pageNumber"] = 0;
		inputdata["pageSize"] = 0;
	}
	return inputdata;
}

//获取接口数据
function A19074_Res_N01_sel_role_control(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.N01_sel_t_role) == false)
        return false;
    if(input["N01_sel_t_role"].length > 0)
    	A19074_rowCheckData = input["N01_sel_t_role"][0];
    if(A19074_table_page == 0)
		return null;
	else{ 
		var json_list = {};
		json_list["total"] = input["N01_sel_t_role_ROWS"];
		json_list["rows"] = input["N01_sel_t_role"];
		return json_list;
	}
}

//刷新按钮
$('#A19074_btn_role_control_refresh').click(function () {
	/*重置查询条件变量*/
	/*refresh query param begin*/
    A19074_tem_ROLE_NAME = "";

	/*refresh query param end*/

	/*重置下拉框集合定义*/
	/*refresh select options begin*/

	/*refresh select options end*/
	
	/*页面重置重新加载*/
	/*biz begin*/
    A19074_init_role_control();
    /*biz end*/
})

//查询按钮
$('#A19074_btn_role_control_query').click(function () {
	/*设置查询条件变量*/
    /*set query param begin*/
    A19074_tem_ROLE_NAME = $("#A19074_qry_ROLE_NAME").val();
	
    /*set query param end*/
	A19074_role_control_query();
})

//vue回调
function A19074_role_control_call_vue(objResult){
	//选择某条记录或自动选择第一条
	if (A19074_select_role_control_rowId != "") 
		A19074_rowCheckData = $("#A19074_role_control_Events").bootstrapTable('getData')[A19074_select_role_control_rowId];
	if(index_subhtml == "XXXTTT"){
	}
	/*查询条件弹窗子页面*/
    /*get find subvue bgein*/
    
	/*get find subvue end*/
	else if(index_subhtml == "sys_vue/t_button.vue"){
        var n = Get_RandomDiv("A673F2",objResult);
        layer.open({
            type: 1,
            area: ['1100px', '600px'],
            fixed: false, //不固定
            maxmin: true,
            content: $(n),
            success: function(layero, index){
            	A19074_toparam["ly_index"] = index;
                loadScript_hasparam("sys_vue/t_button.js","A673F2_t_button_biz_start",A19074_toparam);
            },
            end: function(){
                $(n).hide();
            }
        });
    }
	/*tab页显示子页面*/
	/*get tab subvue begin*/
}

//弹窗1
function A19074_open_to_url1(temindex_subhtml,temrandom_subhtml,temparam){
	A19074_btn = "";
	A19074_prev_btn = "";
	index_subhtml = s_decode(temindex_subhtml);
	inputrandom = s_decode(temrandom_subhtml);
	//本页面传到其他页面参数
	A19074_toparam = JSON.parse(s_decode(temparam));
	if(loadHtmlSubVueFun(index_subhtml,"A19074_role_control_call_vue") == true){
		var n = Get_RandomDiv(inputrandom,"");
		layer.open({
			type: 1,
			area: ['1100px', '600px'],
			fixed: false, //不固定
			maxmin: true,
			content: $(n),
			success: function(layero, index){
				A19074_toparam["ly_index"] = index;
				eval(inputrandom+"_param = {}");
				for(var key in A19074_toparam)
					eval(inputrandom+"_param['"+key+"'] = '"+A19074_toparam[key]+"'");
				//参数传递并赋值
				eval(inputrandom+"_param_set()");
				var tbName = "";
				if(index_subhtml.indexOf("/") == -1)
					tbName = index_subhtml.substring(0,index_subhtml.indexOf(".vue"));
				else
					tbName = index_subhtml.substring(index_subhtml.lastIndexOf("/")+1,index_subhtml.indexOf(".vue"));
				eval(inputrandom+"_init_"+tbName.replace("_$","")+"()");
			},
			end: function(){
				$(n).hide();
			}
		});	
	}
}

//2:系统内tab页
function A19074_open_to_url2(temindex_subhtml,temrandom_subhtml,temparam){
	A19074_btn = "";
	A19074_prev_btn = "";
	index_subhtml = s_decode(temindex_subhtml);
	inputrandom = s_decode(temrandom_subhtml);
	//调用或加载左侧菜单并click
	Add_No_Show_Menu(index_subhtml,inputrandom,JSON.parse(s_decode(temparam)));	
}

//3：浏览器tab页
function A19074_open_to_url3(temindex_subhtml,temrandom_subhtml,temparam){
	A19074_btn = "";
	A19074_prev_btn = "";
	index_subhtml = s_decode(temindex_subhtml);
	inputrandom = s_decode(temrandom_subhtml);
}

//按钮事件触发页面跳转，1:弹窗、2:系统内tab页、3：浏览器tab页
/*open new page begin*/
/*open new page end*/

//打开新页面
function A19074_open_url(objTag,iIndex){
	//弹窗
	if(iIndex == 0)
		A19074_open_to_url1($(objTag).attr("param1"),$(objTag).attr("param2"),$(objTag).attr("param3"));
	//系统内tab页
	else if(iIndex == 1)
		A19074_open_to_url2($(objTag).attr("param1"),$(objTag).attr("param2"),$(objTag).attr("param3"));
	//浏览器tab页
	else if(iIndex == 2)
		A19074_open_to_url3($(objTag).attr("param1"),$(objTag).attr("param2"),$(objTag).attr("param3"));
}

//选择多行数据进行业务操作
function A19074_sel_row_role_control(){
	//获得选中行
	var checkedbox= $("#A19074_role_control_Events").bootstrapTable('getSelections'); 
	//将选中行数据转成jsonStr
	var jsonStr=JSON.stringify(checkedbox);
	//将jsonStr转成jsonObject对象	 
	var jsonObject=jQuery.parseJSON(jsonStr);
	return jsonObject;
	//接着就可以遍历jsonObject数组对象，取出并操作数据
}

//权限全选
$("#A19074_Check_All").change(function(objTag){
	var SUB_NAME = $("input[name='A19074_role_control_rd']:checked").val();
	$.each($("#"+SUB_NAME).find("input[type='checkbox']"), function (i, obj) {
		if($("#A19074_Check_All").is(":checked")){
			obj.checked = true;
		}else{
			obj.checked = false;
		}
	});
});

//选中菜单组
function A19074_menu_group_check(objTag){
	var SUB_NAME = $(objTag).val();
	$.each($("#"+SUB_NAME).find("input[type='checkbox']"), function (i, obj) {
		if($(objTag).is(":checked")){
			obj.checked = true;
		}else{
			obj.checked = false;
		}
	});
}

//子项选中
$("input[type=radio][name=A19074_role_control_rd]").bind("change",function(){
	A19074_sub_show();
});

//隐藏所有sub
function A19074_sub_hidden(SUB_NAME){
	$("#A19074_sub_user").hide();
	$("#A19074_sub_menu").hide();
	$("#A19074_sub_content").hide();
	$("#A19074_sub_proc").hide();
	$("#A19074_sub_btn").hide();
	$("#"+SUB_NAME).show();
}

//显示权限控制子项
function A19074_sub_show(){
	//选择某条记录或自动选择第一条并传递参数
	if (A19074_select_role_control_rowId != "") 
		rowData = $("#A19074_role_control_Events").bootstrapTable('getData')[A19074_select_role_control_rowId];
	else
		rowData = A19074_rowCheckData;
	$("#A19074_def_role").html("选中角色:=>"+s_decode(rowData["ROLE_NAME"])+"");
	var SUB_NAME = $("input[name='A19074_role_control_rd']:checked").val();
	A19074_sub_hidden(SUB_NAME);
	
	if(SUB_NAME == "A19074_sub_user")
		A19074_A01_GGRHH5(rowData["MAIN_ID"]);
	else if(SUB_NAME == "A19074_sub_menu")
		A19074_A01_KKT551(rowData["MAIN_ID"]);
	else if(SUB_NAME == "A19074_sub_content")
		A19074_A01_TTTN45(rowData["MAIN_ID"]);
	else if(SUB_NAME == "A19074_sub_proc")
		$("#A19074_btn_sub_proc_query").click();
	else if(SUB_NAME == "A19074_sub_btn")
		A19074_A01_7TT5K1(rowData["MAIN_ID"]);
}

$("#A19074_btn_sub_proc_query").click(function (){
	A19074_A01_VVG456(rowData["MAIN_ID"]);
});

//请求按钮禁用接口权限
function A19074_A01_7TT5K1(USER_MAIN_ID){
	var inputdata = {
			"param_name": "A01_7TT5K1",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":USER_MAIN_ID
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "A19074_get_A01_7TT5K1");
}

//获取按钮禁用接口权限
function A19074_get_A01_7TT5K1(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_7TT5K1) == false)
        return false;
	$("#A19074_sub_btn").html("");
	var GROUP_ID = "";
	var MENU_ID = "";
	var iCount = 0;
	$.each(input.A01_7TT5K1, function (i, obj) {
		var temMAIN_ID = obj["MAIN_ID"];
		var temMENU_NAME = s_decode(obj["MENU_NAME"]);
		var temGROUP_ID = obj["GROUP_ID"];
		var temMENU_ID = obj["MENU_ID"];
		var temBTN_CN_NAME = s_decode(obj["BTN_CN_NAME"]);
		var bGFlag = false;
		var temCheck = "";
		//添加组
		if(GROUP_ID != temGROUP_ID){
			var group_html = "<div>"
				+"<input id=\"A19074_sbm_ck_"+temGROUP_ID.toString()+"\" onclick=\"A19074_menu_group_check(this)\" "
				+"type=\"checkbox\" value=\"A19074_sbm_"+temGROUP_ID.toString()+"\" >"  //checked=\"true\"
				+"<label style=\"margin-left: 10px;\" for=\"A19074_sbm_ck_"+temGROUP_ID.toString()+"\">"+s_decode(obj["GROUP_CN_NAME"])+"</label>"
				+"</div>";
			GROUP_ID = temGROUP_ID;
			var menu_div = "<div style=\"margin-left: 10px;\" id=\"A19074_sbm_"+temGROUP_ID.toString()+"\">";
			$("#A19074_sub_btn").append(group_html);
			$("#A19074_sub_btn").append(menu_div);
			bGFlag = true;
		}
		
		//添加菜单
		if(MENU_ID != temMENU_ID){
			iCount = 0;
			MENU_ID = temMENU_ID;
			var target_menu = "<div><input id=\"A19074_sbmenu_"+temMENU_ID.toString()+"\" onclick=\"A19074_menu_group_check(this)\" type=\"checkbox\" value=\"A19074_sbmbtn_"+temMENU_ID+"\">"
		    	+"<label for=\"A19074_sbmenu_"+temMENU_ID.toString()+"\">"+temMENU_NAME+"</label>"
		    	+"<a id=\"A19074_btn_load_"+temMENU_ID.toString()+"\" onclick=\"A19074_Load_t_button('"+temMENU_ID+"','"+temMENU_NAME+"')\"><i class=\"fa fa-cloud-download\"></i>加载</a>"
		    	+"</div>";
			var menu_div = "<div style=\"margin-left: 20px;\" id=\"A19074_sbmbtn_"+temMENU_ID.toString()+"\">";			
			$("#A19074_sub_btn").find("div[id='A19074_sbm_"+temGROUP_ID.toString()+"']").append(target_menu);		
			$("#A19074_sub_btn").find("div[id='A19074_sbm_"+temGROUP_ID.toString()+"']").append(menu_div);
		}
		
		//添加菜单按钮
		if(temMAIN_ID != ""){
			if(obj["ROLE_MAIN_ID"] != "")
				temCheck = "checked=\"true\"";
			else
				temCheck = "";
			var target_btn = "<input id=\"A19074_sub_btn_"+temMAIN_ID.toString()+"\" type=\"checkbox\" value=\""+temMAIN_ID+"\" "+temCheck+">"
		    	+"<label for=\"A19074_sub_btn_"+temMAIN_ID.toString()+"\">"+temBTN_CN_NAME+"</label>";
			iCount ++;
			if(iCount % 5 == 0)
				target_btn += "<br>";
			$("#A19074_sub_btn").find("div[id='A19074_sbmbtn_"+temMENU_ID.toString()+"']").append(target_btn);
		}
	});
}

//加载页面按钮
function A19074_Load_t_button(menu_id,menu_name){
//	var temparam = "{\"MENU_MAIN_ID\":\""+menu_id+"\",\"MENU_MAIN_ID_cn_name\":\""+menu_name+"\"}";	
//	index_subhtml = "sys_vue/t_button.vue";
//  random_subhtml = "A673F2";
//	A19074_open_to_url1(index_subhtml,random_subhtml,temparam);
	var inputdata = {
			"param_name": "N01_sel_menu_info_ByID",
	        "session_id": session_id,
	        "login_id": login_id
	        ,"param_value1":menu_id
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "A19074_get_N01_sel_menu_info_ByID");
}
var A19074_select_MENU_INFO = null;
//加载查询页面详情完成
function A19074_get_N01_sel_menu_info_ByID(input){
	layer.close(ly_index);
	//查询失败
	if (Call_OpeResult(input.N01_sel_menu_info_ByID) == false)
		return false;
	
	A19074_select_MENU_INFO = input.N01_sel_menu_info_ByID[0];
	var selfdiv = Get_RDivNoBuild(A19074_select_MENU_INFO["S_DESC"],"")
	//页面已打开
	if($(selfdiv).length > 0){
		A19074_Load_div("")
	}
	//先加载页面
	else{
		index_subhtml = s_decode(A19074_select_MENU_INFO["MENU_URL"]);
		loadHtmlSubVueFun(index_subhtml,"A19074_Load_div_Call_vue");
	}
}
//子div加载
function A19074_Load_div_Call_vue(objResult){
	var n = Get_RandomDiv(A19074_select_MENU_INFO["S_DESC"],objResult);
	$(n).hide();
	loadScript_hasparam(s_decode(A19074_select_MENU_INFO["MENU_URL"]).replace(".vue",".js"),"A19074_Load_div",{});
}
//批量写入t_button数据
function A19074_Load_div(divResult){
	var selfdiv = Get_RDivNoBuild(A19074_select_MENU_INFO["S_DESC"],"")
	var inputdata = {
			"param_name": "A01_NKJ001",
	        "session_id": session_id,
	        "login_id": login_id
	        ,"param_value1": ","
		    ,"param_value2": ","
	};
	
	var buttons = $(selfdiv).find('button');
	$.each(buttons, function (i, obj) {
		if(obj.id != "" && inputdata["param_value1"].indexOf(","+obj.id+",") == -1){
			inputdata["param_value1"] += obj.id+",";
			inputdata["param_value2"] += obj.textContent+",";
		}
	});
	inputdata["param_value1"] = s_encode(inputdata["param_value1"]);
	inputdata["param_value2"] = s_encode(inputdata["param_value2"]);
	inputdata["param_value3"] = A19074_select_MENU_INFO["MAIN_ID"];
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "A19074_get_A01_NKJ001");
}
//批量写入t_button数据结果
function A19074_get_A01_NKJ001(input){
	layer.close(ly_index);
	//查询失败
	if (Call_OpeResult(input.A01_NKJ001) == false)
		return false;
	A19074_sub_show();
}


//请求用户接口权限
function A19074_A01_VVG456(ROLE_MAIN_ID){
	var inputdata = {
			"param_name": "A01_VVG456",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":ROLE_MAIN_ID
			,"param_value2":s_encode($("#A19074_qry_INF_CN_NAME").val())
			,"param_value3":s_encode($("#A19074_qry_INF_EN_NAME").val())
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "A19074_get_A01_VVG456");
}

//获取角色接口信息
function A19074_get_A01_VVG456(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_VVG456) == false)
        return false;
	$("#A19074_sub_proc_main").html("");
	
	var iCount = 0;
	$.each(input.A01_VVG456, function (i, obj) {
		var temMain_ID = obj["MAIN_ID"];
		var temINF_CN_NAME = s_decode(obj["INF_CN_NAME"]);
		var temCheck = "";
		if(obj["ROLE_MAIN_ID"] != "")
			temCheck = "checked=\"true\"";
		else
			temCheck = "";
		var target_proc = "<input id=\"A19074_sub_proc_"+temMain_ID.toString()+"\" type=\"checkbox\" value=\""+temMain_ID+"\" "+temCheck+">"
	    	+"<label for=\"A19074_sub_proc_"+temMain_ID.toString()+"\">"+temINF_CN_NAME+"</label>";
		iCount ++;
		if(iCount % 3 == 0)
			target_proc += "<br>";
		$("#A19074_sub_proc_main").append(target_proc);
	});
}

//请求角色首页菜单信息
function A19074_A01_TTTN45(ROLE_MAIN_ID){
	var inputdata = {
			"param_name": "A01_TTTN45",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":ROLE_MAIN_ID
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "A19074_get_A01_TTTN45");
}

//获取用户首页菜单信息
function A19074_get_A01_TTTN45(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_TTTN45) == false)
        return false;
	$("#A19074_sub_content").html("");
	var GROUP_ID = "";
	var iCount = 0;
	$.each(input.A01_TTTN45, function (i, obj) {
		var temMain_ID = obj["MAIN_ID"];
		var temROLE_NAME = s_decode(obj["MENU_NAME"]);
		var temCheck = "";
		var temGROUP_ID = obj["GROUP_ID"];
		if(GROUP_ID != temGROUP_ID){
			iCount = 0;
			var group_html = "<div>"
				+s_decode(obj["GROUP_CN_NAME"])
				+"</div>";
			GROUP_ID = temGROUP_ID;
			var menu_div = "<div style=\"margin-left: 10px;\" id=\"A19074_sc_"+temGROUP_ID.toString()+"\">";
			$("#A19074_sub_content").append(group_html);
			$("#A19074_sub_content").append(menu_div);
		}
		
		iCount ++;
		if(obj["ROLE_MAIN_ID"] != "")
			temCheck = "checked=\"true\"";
		else
			temCheck = "";
		var target_menu = "<input id=\"A19074_sub_content_"+temMain_ID.toString()+"\" name=\"A19074_sub_content_rd\" type=\"radio\" value=\""+temMain_ID+"\" "+temCheck+">"
	    	+"<label for=\"A19074_sub_content_"+temMain_ID.toString()+"\">"+temROLE_NAME+"</label>";
		if(iCount % 5 == 0)
			target_menu += "<br>";
		$("#A19074_sub_content").find("div[id='A19074_sc_"+temGROUP_ID.toString()+"']").append(target_menu);
	});
}

//请求角色菜单信息
function A19074_A01_KKT551(ROLE_MAIN_ID){
	var inputdata = {
			"param_name": "A01_KKT551",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":ROLE_MAIN_ID
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "A19074_get_A01_KKT551");
}

//获取用户菜单信息
function A19074_get_A01_KKT551(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_KKT551) == false)
        return false;
	$("#A19074_sub_menu").html("");
	var GROUP_ID = "";
	var iCount = 0;
	$.each(input.A01_KKT551, function (i, obj) {
		var temMain_ID = obj["MAIN_ID"];
		var temROLE_NAME = s_decode(obj["MENU_NAME"]);
		var temCheck = "";
		var temGROUP_ID = obj["GROUP_ID"];
		if(GROUP_ID != temGROUP_ID){
			iCount = 0;
			var group_html = "<div>"
				+"<input id=\"A19074_smg_ck_"+temGROUP_ID.toString()+"\" onclick=\"A19074_menu_group_check(this)\" "
				+"type=\"checkbox\" value=\"A19074_smg_"+temGROUP_ID.toString()+"\" >"  //checked=\"true\"
				+"<label style=\"margin-left: 10px;\" for=\"A19074_smg_ck_"+temGROUP_ID.toString()+"\">"+s_decode(obj["GROUP_CN_NAME"])+"</label>"
				+"</div>";
			GROUP_ID = temGROUP_ID;
			var menu_div = "<div style=\"margin-left: 10px;\" id=\"A19074_smg_"+temGROUP_ID.toString()+"\">";
			$("#A19074_sub_menu").append(group_html);
			$("#A19074_sub_menu").append(menu_div);
		}

		iCount ++;
		if(obj["ROLE_MAIN_ID"] != "")
			temCheck = "checked=\"true\"";
		else
			temCheck = "";
		var target_menu = "<input id=\"A19074_sub_menu_"+temMain_ID.toString()+"\" type=\"checkbox\" value=\""+temMain_ID+"\" "+temCheck+">"
	    	+"<label for=\"A19074_sub_menu_"+temMain_ID.toString()+"\">"+temROLE_NAME+"</label>";
		if(iCount % 5 == 0)
			target_menu += "<br>";
		$("#A19074_sub_menu").find("div[id='A19074_smg_"+temGROUP_ID.toString()+"']").append(target_menu);
	});
}

//请求角色用户信息
function A19074_A01_GGRHH5(ROLE_MAIN_ID){
	var inputdata = {
			"param_name": "A01_GGRHH5",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":ROLE_MAIN_ID
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "A19074_get_A01_GGRHH5");
}

//获取用户角色信息
function A19074_get_A01_GGRHH5(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_GGRHH5) == false)
        return false;
	$("#A19074_sub_user").html("");
	
	var iCount = 0;
	$.each(input.A01_GGRHH5, function (i, obj) {
		var temMain_ID = obj["MAIN_ID"];
		var temUSER_NAME = s_decode(obj["USER_NAME"]);
		var temCheck = "";
		if(obj["ROLE_MAIN_ID"] != "")
			temCheck = "checked=\"true\"";
		else
			temCheck = "";
		var target_role = "<input id=\"A19074_sub_role_"+temMain_ID.toString()+"\" type=\"checkbox\" value=\""+temMain_ID+"\" "+temCheck+">"
	    	+"<label for=\"A19074_sub_role_"+temMain_ID.toString()+"\">"+temUSER_NAME+"</label>";
		iCount ++;
		if(iCount % 5 == 0)
			target_role += "<br>";
		$("#A19074_sub_user").append(target_role);
	});
}

//配置信息保存
$("#A19074_btn_Save").click(function (){
	var rowData = null;
	if (A19074_select_role_control_rowId != "") 
		rowData = $("#A19074_role_control_Events").bootstrapTable('getData')[A19074_select_role_control_rowId];
	else
		rowData = A19074_rowCheckData;
	
	var SUB_NAME = $("input[name='A19074_role_control_rd']:checked").val();
	var NO_MAIN_ID = "";
	var SUB_MAIN_ID = "";
	if(SUB_NAME == "A19074_sub_user"){
		$.each($("#"+SUB_NAME).find("input[type='checkbox']:checked"), function (i, obj) {
			if(SUB_MAIN_ID == "")
				SUB_MAIN_ID = $(obj).val();
			else
				SUB_MAIN_ID += ","+$(obj).val();
		});
		$.each($("#"+SUB_NAME).find("input[type='checkbox']:not(:checked)"), function (i, obj) {
			if(NO_MAIN_ID == "")
				NO_MAIN_ID = $(obj).val();
			else
				NO_MAIN_ID += ","+$(obj).val();
		});
		
		var inputdata = {
				"param_name": "A01_USEROL",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":rowData["MAIN_ID"]		//ROLE_MAIN_ID
				,"param_value2":SUB_MAIN_ID				//USER_MAIN_ID
				,"param_value3":"-1"					//NO_ROLE_MAIN_ID
				,"param_value4":NO_MAIN_ID				//NO_USER_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "A19074_get_A01_USEROL");
	}
	else if(SUB_NAME == "A19074_sub_menu"){
		$.each($("#"+SUB_NAME).find("input[id^='A19074_sub_menu_']:checked"), function (i, obj) {
			if(SUB_MAIN_ID == "")
				SUB_MAIN_ID = $(obj).val();
			else
				SUB_MAIN_ID += ","+$(obj).val();
		});
		$.each($("#"+SUB_NAME).find("input[id^='A19074_sub_menu_']:not(:checked)"), function (i, obj) {
			if(NO_MAIN_ID == "")
				NO_MAIN_ID = $(obj).val();
			else
				NO_MAIN_ID += ","+$(obj).val();
		});

		var inputdata = {
				"param_name": "A01_ROLMEU",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":SUB_MAIN_ID			//MENU_MAIN_ID
				,"param_value2":rowData["MAIN_ID"]	//ROLE_MAIN_ID
				,"param_value3":NO_MAIN_ID			//NO_MENU_MAIN_ID
				,"param_value4":"-1"				//NO_ROLE_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "A19074_get_A01_ROLMEU");
	}
	else if(SUB_NAME == "A19074_sub_content"){
		SUB_MAIN_ID = $("#"+SUB_NAME).find("input[type='radio']:checked").val();
		
		var inputdata = {
				"param_name": "A01_ROLCON",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":SUB_MAIN_ID			//BTN_MAIN_ID
				,"param_value2":rowData["MAIN_ID"]	//ROLE_MAIN_ID
				,"param_value3":"-1"				//NO_BTN_MAIN_ID
				,"param_value4":"-1"				//NO_ROLE_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "A19074_get_A01_ROLCON");
	}
	else if(SUB_NAME == "A19074_sub_proc"){
		$.each($("#"+SUB_NAME).find("input[type='checkbox']:checked"), function (i, obj) {
			if(SUB_MAIN_ID == "")
				SUB_MAIN_ID = $(obj).val();
			else
				SUB_MAIN_ID += ","+$(obj).val();
		});
		$.each($("#"+SUB_NAME).find("input[type='checkbox']:not(:checked)"), function (i, obj) {
			if(NO_MAIN_ID == "")
				NO_MAIN_ID = $(obj).val();
			else
				NO_MAIN_ID += ","+$(obj).val();
		});
		
		var inputdata = {
				"param_name": "A01_ROLPRO",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":SUB_MAIN_ID			//PROC_ID
				,"param_value2":rowData["MAIN_ID"]	//ROLE_MAIN_ID
				,"param_value3":NO_MAIN_ID			//NO_PROC_ID
				,"param_value4":"-1"				//NO_ROLE_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "A19074_get_A01_ROLPRO");
	}
	else if(SUB_NAME == "A19074_sub_btn"){
		$.each($("#"+SUB_NAME).find("input[id^='A19074_sub_btn_']:checked"), function (i, obj) {
			if(SUB_MAIN_ID == "")
				SUB_MAIN_ID = $(obj).val();
			else
				SUB_MAIN_ID += ","+$(obj).val();
		});
		$.each($("#"+SUB_NAME).find("input[id^='A19074_sub_btn_']:not(:checked)"), function (i, obj) {
			if(NO_MAIN_ID == "")
				NO_MAIN_ID = $(obj).val();
			else
				NO_MAIN_ID += ","+$(obj).val();
		});
		
		var inputdata = {
				"param_name": "A01_ROLBTN",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":SUB_MAIN_ID			//BTN_MAIN_ID
				,"param_value2":rowData["MAIN_ID"]	//ROLE_MAIN_ID
				,"param_value3":NO_MAIN_ID			//NO_BTN_MAIN_ID
				,"param_value4":"-1"				//NO_ROLE_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "A19074_get_A01_ROLBTN");
	}
});

//编辑用户角色关联信息
function A19074_get_A01_USEROL(input){
	layer.close(ly_index);
	//操作失败
    if (Call_OpeResult(input.A01_USEROL) == false)
        return false;
}

//编辑角色菜单关联信息
function A19074_get_A01_ROLMEU(input){
	layer.close(ly_index);
	//操作失败
    if (Call_OpeResult(input.A01_ROLMEU) == false)
        return false;
}

//编辑角色接口关联信息
function A19074_get_A01_ROLPRO(input){
	layer.close(ly_index);
	//操作失败
    if (Call_OpeResult(input.A01_ROLPRO) == false)
        return false;
}

//编辑角色按钮关联信息
function A19074_get_A01_ROLBTN(input){
	layer.close(ly_index);
	//操作失败
  if (Call_OpeResult(input.A01_ROLBTN) == false)
      return false;
}

//编辑角色首页关联信息
function A19074_get_A01_ROLCON(input){
	layer.close(ly_index);
	//操作失败
  if (Call_OpeResult(input.A01_ROLCON) == false)
      return false;
}
